package zuoye.zuoye4;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Test {
    public static void main(String[] args) {
        ArrayList<String> farmer = new ArrayList<>();
        ArrayList<String> farmer1 = new ArrayList<>();
        ArrayList<String> landlord = new ArrayList<>();
        ArrayList<String> brand = new ArrayList<>();
        ArrayList<String> dipai = new ArrayList<>();
        String[] suits = {"♠", "♥", "♣", "♦"};
        String[] ranks = {"A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K",};

        for (String suit : suits) {
            for (String rank : ranks) {
                brand.add(suit + rank);
            }
        }

        brand.add("小王");
        brand.add("大王");
        System.out.println( brand);
        System.out.println("=========");

        //洗牌：Collections集合工具类：打乱顺序
        Collections.shuffle( brand );
        System.out.println(brand);
        System.out.println("=========");

        for (int i = 0; i < brand.size()-3; i++) {
            if(i%3==0){
                    farmer.add(brand.get(i));
            } else if (i%3==1) {
                    farmer1.add(brand.get(i));
            }else{
                landlord.add(brand.get(i));

            }
        }

        dipai.add(brand.get(brand.size()-1));
        dipai.add(brand.get(brand.size()-2));
        dipai.add(brand.get(brand.size()-3));
        System.out.println("农民手牌："+farmer);
        System.out.println("农民1手牌："+farmer1);
        System.out.println("地主手牌："+landlord);
        System.out.println("底牌："+dipai);

    }
}
